package com.cmsz.shuang.booter.web;

import com.vaadin.annotations.Theme;
import com.vaadin.server.VaadinRequest;
import com.vaadin.spring.annotation.SpringUI;
import com.vaadin.ui.Button;
import com.vaadin.ui.Notification;
import com.vaadin.ui.TextField;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

@SpringUI(path="/ui2")
@Theme("valo")
public class VaadinUI2 extends UI{

	@Override
	protected void init(VaadinRequest request) {
		final TextField name = new TextField("Name");
	    final Button greetButton = new Button("Greet");
	    
	    
	    greetButton.addClickListener(
	    	e -> printtag(name.getValue())	
	  //    e -> Notification.show("Hi " + name.getValue())
	    );
	    setContent(new VerticalLayout(name, greetButton));
	    
		
	}
	
	public void printtag(String str)
	{
		Notification.show("Hi ---" + str);
		System.out.println("this is backend str: "+ str);
	}

}
